package com.zzyl.nursing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.domain.Reservation;
import com.zzyl.nursing.vo.ReservationResidueNumVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ReservationMapper extends BaseMapper<Reservation> {
    @Select("select time, 6 - count(*) as count from reservation\n" +
            "    where time between #{startTime} and #{startTime}\n" +
            "    and status != 2 group by time;")
    List<ReservationResidueNumVo> getSurplusNum(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}
